package com.example.javapoint.threads.setname;

/*
使用Thread setName方法设置线程名称
 */
class SonTread extends Thread {
    @Override
    public void run() {
        System.out.println("SonTread is running...");
    }
}
public class ThreadSetName {
    public static void main(String[] args) {
        SonTread sonTread1 = new SonTread();
        SonTread sonTread2 = new SonTread();
        System.out.println("SonTread1's name is " + sonTread1.getName());
        System.out.println("SonTread2's name is " + sonTread2.getName());

        sonTread1.start();
        sonTread2.start();

        sonTread1.setName("alibaba");
        System.out.println("SonTread1's name is " + sonTread1.getName());
    }
}
